<?php
/**
 * File description.
 * 
 * @filesource
 * @author Michael N <webjestic@gmail.comt>
 * @link http://webjestic.net webJestic
 * @license http://www.opensource.org/licenses/bsd-license.php BSD
 * @copyright Copyright (c) 2009 - webJestic.NET.  All Rights Reserved.
 * 
 * 
 * @category   Engine
 * @package    Resources
 * @subpackage Cache 
 */

class Engine_Resource_Cache extends Zend_Application_Resource_ResourceAbstract {
	
	protected $_cache;
	
	public function init() {
		return $this->getCache();
	}
	
	public function getCache() {
		// Configure Zend_Cache with application.ini and default options
		$options = $this->getOptions();		
		$frontend = array('lifetime' => $options['lifetime'],
							'automatic_serialization' => true
		);		
		$backend = array('cache_dir' => $options['cache_dir']);
		
		// Create the Cache and store it in the Registry
		$this->_cache = Zend_Cache::factory('Core', 'File', $frontend, $backend);		
		Zend_Registry::set('Zend_Cache', $this->_cache);
		
		return $this->_cache;
	}
	
}
?>